package com.neusoft.bootweb.common;


import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;


@RestControllerAdvice
public class GlobsExceptionHandler {

    @ExceptionHandler(value = MyExceptionHandler.class)
    public Object myExceptionHandler(HttpServletRequest request ,Exception ex)
    {
        System.out.println("系统错误，参数有问题！！！");
        Map<String,Object> map = new HashMap<>();
        map.put("code",100);
        map.put("message",ex.getMessage());
        map.put("url",request.getRequestURI().toString());
        map.put("data","服务器故障，请求失败！！！");

        return map;
    }
}
